export default {
    namespaced: true,
    state: {
        isShowToast: false,
        toastMsg: '我是vuex提示内容',
        toastType: 'warning',
    },
    mutations: {
        changeIsShowToast(state, payload) {
            // console.log('修改提示框显示状态mutations...', payload);
            state.isShowToast = payload.isShow;
            if (payload.isShow) {
                state.toastMsg = payload.title;
                state.toastType = payload.type;
            }
        },
    },
    actions: {
        asyncShowToast(context, payload) {
            // console.log('actions---', payload);
            context.commit('changeIsShowToast', payload);
            setTimeout(() => {
                context.commit('changeIsShowToast', {
                    isShow: false,
                });
            }, 2000);
        },
    },
};
